package com.chuyu.jzwboa.fragment.message;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.chuyu.jzwboa.R;
import com.chuyu.jzwboa.adapter.message.MsgViewPagerAadapter;
import com.chuyu.jzwboa.base.MVPBaseFragment;
import com.chuyu.jzwboa.presenter.message.MsgFragPresenter;
import com.chuyu.jzwboa.utils.sys.TabLayoutUtil;
import com.chuyu.jzwboa.view.iview.message.IMsgFargView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * @author 杨仕俊
 * @description 消息fragment
 * Created by wo on 2017/12/15.
 */

public class MsgFragment extends MVPBaseFragment<IMsgFargView, MsgFragPresenter> implements IMsgFargView {
    @BindView(R.id.tab_layout)
    TabLayout tabLayout;
    @BindView(R.id.msg_viewpager)
    ViewPager msgViewpager;

    @Override
    protected void initView() {
        ChatFragment chatFragment = new ChatFragment();
        NotifyFragment notifyFragment = new NotifyFragment();
        List<String> list = new ArrayList<>();
        List<Fragment> listfragment = new ArrayList<>();
        list.add("通知");
        list.add("聊天");
        listfragment.add(notifyFragment);
        listfragment.add(chatFragment);
        MsgViewPagerAadapter pagerAadapter = new MsgViewPagerAadapter(getChildFragmentManager(), list, listfragment);
        msgViewpager.setAdapter(pagerAadapter);
        tabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
        TabLayoutUtil.reflexToWith(tabLayout);
        tabLayout.setupWithViewPager(msgViewpager);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected int initContentLayout() {
        return R.layout.framgent_msg;
    }

    @Override
    public MsgFragPresenter createPresenter() {
        return new MsgFragPresenter();
    }




}
